<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePrivilegesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('privileges', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->comment('权限名称');
            $table->string('name')->unique()->comment('权限名称，英文字符，唯一');
            $table->tinyInteger('type')->comment('权限类型，1：模块，2：按钮');
            $table->bigInteger('parent')->default(0)->comment('父权限的ID');
            $table->string('desc')->nullable()->comment('权限描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('privileges');
    }
}
